<?php 
class ManualOperation extends CS_Controller
{
    public function _init()
    {
        $this->load->helper(array('common','api'));
        $this->load->model('user_model','user');
        $this->load->model('order_base_model','order_base');
        $this->load->model('order_edit_model','order_edit');
        $this->load->model('api_taobao_model','api_taobao');
        $this->load->model('api_receive_order_model','api_receive_order');
    }
    
    /**
     * 生成分销商密钥
     */
    public function make_key()
    {
        $data = array('type'=>'make_key');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于着想订单接口(OTA对接着想接口需要密钥)
     */
    public function makekeyPost()
    {
        $user_name = $this->input->get_post('user_name');
        
        $userQuery = $this->user->findByUserName(array('user_name'=>$user_name));
        if($userQuery->num_rows() <= 0) {
            $this->error('manualoperation/make_key', $this->input->get(), '分销商账号'.$user_name.'不存在');
        }
        $userRow = $userQuery->row();
        $key = $userRow->key;
        
        if($key) {
            $this->error('manualoperation/make_key', $this->input->get(), '分销商账号密钥已存在.密钥:'.$key);
        }
        
        //生成密钥
        $time = time();
        $make_key = md5($user_name.$time);
        //将生成的密钥添加到用户表中
        $this->user->updateUser(array('user_name'=>$user_name),array('key'=>$make_key));
        
        $this->success('manualoperation/make_key', $this->input->get(), '分销商账号密钥生成成功.密钥:'.$make_key);
    }
    
    private function curl($url,$curlPost)
    {
        //初始化一个curl对象
        $ch = curl_init();
        //设置你需要抓取的url
        curl_setopt($ch, CURLOPT_URL, $url);
        //设置header
        curl_setopt($ch, CURLOPT_HEADER, 0);
        //设置curl参数,要求结果保存到字符串中还是输出到屏幕上.
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        //post提交
        curl_setopt($ch, CURLOPT_POST, 1);
        //post参数设置
        curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
        //运行curl,请求网页
        $data = curl_exec($ch);
        //关闭url请求
        curl_close($ch);
        
        return $data;
    }
    
    /**
     * 手动退票
     */
    public function refund()
    {
        $data = array('type'=>'refund');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于淘宝过期订单退票、OTA部分退票或者OTA过期订单退票(查询到的订单数量全部退掉)
     */
    public function refundPost()
    {
        $order_id = $this->input->get_post('order_id');
        $number = $this->input->get_post('number');
        
        //$url = $this->config->main_base_url.'api/refundHand';
		$url = $this->config->api_base_url.'api/refundHand';
        $curlPost = 'order_id='.$order_id.'&number='.$number;
		
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
		if($data && $data == '成功') {
		    $this->success('manualoperation/refund', $this->input->get(), $data);
		} else {
		    $this->error('manualoperation/refund', $this->input->get(), $data);
		}
    }
    
    /**
     * 手动分润
     */
    public function allot()
    {
        $data = array('type'=>'allot');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于着想平台已检票但未分润的订单
     */
    public function allotPost()
    {
        $order_id = $this->input->get_post('order_id');
    
        $url = $this->config->api_base_url.'checkOrderNotAllot';
        $curlPost = 'order_id='.$order_id;
    
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == 'success') {
            $this->success('manualoperation/allot', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/allot', $this->input->get(), $data);
        }
    }
    
    /**
     * 手动检票
     */
    public function check()
    {
        $data = array('type'=>'check');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于只核销着想平台上的订单(如淘宝过期订单无法核销)
     */
    public function checkPost()
    {
        $order_id = $this->input->get_post('order_id');
        $number = $this->input->get_post('number');
    
        //$url = $this->config->main_base_url.'api/checkHand';
		$url = $this->config->api_base_url.'api/checkHand';
        $curlPost = 'order_id='.$order_id.'&number='.$number;
    
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '检票成功') {
            $this->success('manualoperation/check', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/check', $this->input->get(), $data);
        }
    }
    
    /**
     * 手动推送
     */
    public function push()
    {
        $data = array('type'=>'push');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于将核销信息推送给去哪儿、OTA(对接着想接口的OTA、去哪儿、淘宝等)
     */
	 public function pushPost()
    {
        $order_id = $this->input->get_post('order_id');
		$number = $this->input->get_post('number');
        
        $orderBaseQuery = $this->order_base->findById($order_id);
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/push', $this->input->get(), '订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
        
        $curlPost = 'order_id='.$order_id.'&type=check&number='.$number;
        if((($bit_wan & 4) == 4)) {
            $url = $this->config->api_base_url.'pushOrderInfoToOta';
        } else {
            $this->error('manualoperation/push', $this->input->get(), '订单'.$order_id.'不是对接订单');
        }
        
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '推送成功') {
            $this->success('manualoperation/push', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/push', $this->input->get(), $data);
        }
    }
    /*public function pushPost()
    {
        $order_id = $this->input->get_post('order_id');
        
        $orderBaseQuery = $this->order_base->findById($order_id);
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/push', $this->input->get(), '订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
        
        $curlPost = 'order_id='.$order_id;
        //如果是去哪儿订单
        if(($bit_wan&4096) == 4096) {
			$url = $this->config->api_base_url.'qunarApi/handSendConsumeInfo';
        }elseif((($bit_wan&4) == 4) && (($bit_wan&2048) != 2048) && (($bit_wan&4096) != 4096) && (($bit_wan&8192) != 8192) && (($bit_wan&16384) != 16384)) {
            $url = $this->config->api_base_url.'pushOrderInfoToOta';
            $curlPost = 'order_id='.$order_id.'&type=check';
        } else {
            $this->error('manualoperation/push', $this->input->get(), '订单'.$order_id.'不是对接订单');
        }
        
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '推送成功') {
            $this->success('manualoperation/push', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/push', $this->input->get(), $data);
        }
    }*/
    
    /**
     * 手动推送
     */
    private function push_refund()
    {
        $data = array('type'=>'push_refund');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于将退票审核信息推送给OTA(对接着想接口的OTA,不包含去哪儿、淘宝等)
     */
    private function pushrefundPost()
    {
        $order_id = $this->input->get_post('order_id');
        $edit_id = $this->input->get_post('edit_id');
    
        $orderBaseQuery = $this->order_edit->select_order_edit_base_info(array('order_id'=>$order_id,'edit_id'=>$edit_id),'bit_wan');
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/push_refund', $this->input->get(), '订单'.$order_id.'|'.$edit_id.'信息不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
    
        //如果是对接过来的订单，不包含去哪儿、淘宝、百度、美团订单
        if((($bit_wan&4) == 4) && (($bit_wan&2048) != 2048) && (($bit_wan&4096) != 4096) && (($bit_wan&8192) != 8192) && (($bit_wan&16384) != 16384)) {
            $url = $this->config->api_base_url.'pushOrderInfoToOta';
        } else {
            $this->error('manualoperation/push_refund', $this->input->get(), '订单'.$order_id.'不是对接订单');
        }
        $curlPost = 'order_id='.$order_id.'&edit_id='.$edit_id.'&type=refund';
        
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '推送成功') {
            $this->success('manualoperation/push_refund', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/push_refund', $this->input->get(), $data);
        }
    }
    
    /**
     * 淘宝手动核销
     */
    public function tb_check()
    {
        $data = array('type'=>'tb_check');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于淘宝未过期订单(着想平台订单已核销但是淘宝订单未核销)
     */
    public function tbcheckPost()
    {
        $order_id = $this->input->get_post('order_id');
        $number = $this->input->get_post('number');
        $mac_id = $this->input->get_post('mac_id');
    
        $orderBaseQuery = $this->order_base->findById($order_id);
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/tb_check', $this->input->get(), '订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
		$other_id = $orderBaseRow->other_id;
    
        //如果不是淘宝订单
        if(($bit_wan&2048) != 2048) {
            $this->error('manualoperation/tb_check', $this->input->get(), '订单'.$order_id.'不是淘宝订单');
        }
        
        //$url = $this->config->main_base_url.'api/tbopen/consume';
		$url = $this->config->api_base_url.'taobaoApi/taobaoHandConsume';
		//查询订单是码商系统V1下的订单还是码商系统V2下的订单
        $apiRecevieOrderWhere = array('api_type'=>'taobaov2', 'other_id'=>$other_id, 'receive_type'=>'send');
        $apiRecevieOrderQuery = $this->api_receive_order->selectApiReceiveOrder($apiRecevieOrderWhere, 'receive_id', 1);
        if ($apiRecevieOrderQuery->num_rows() > 0) {
            $url = $this->config->api_base_url.'taobaoApiV2/taobaoHandConsume';
        }
        $curlPost = 'order_id='.$order_id.'&number='.$number.'&mac_id='.$mac_id;
        
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '成功') {
            $this->success('manualoperation/tb_check', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/tb_check', $this->input->get(), $data);
        }
    }
    
    /**
     * 淘宝手动核销查询
     */
    public function tb_beforeconsume()
    {
        $data = array('type'=>'tb_beforeconsume');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于淘宝未过期订单(着想平台订单已核销但是淘宝订单未核销)
     */
    public function tbbeforeconsumePost()
    {
        $order_id = $this->input->get_post('order_id');
        $mac_id = $this->input->get_post('mac_id');
    
        $orderBaseQuery = $this->order_base->findById($order_id);
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/tb_beforeconsume', $this->input->get(), '订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
		$other_id = $orderBaseRow->other_id;
    
        //如果不是淘宝订单
        if(($bit_wan&2048) != 2048) {
            $this->error('manualoperation/tb_beforeconsume', $this->input->get(), '订单'.$order_id.'不是淘宝订单');
        }
    
        //$url = $this->config->main_base_url.'api/tbopen/beforeconsume';
		$url = $this->config->api_base_url.'taobaoApi/taobaoHandBeforeConsume';
		//查询订单是码商系统V1下的订单还是码商系统V2下的订单
        $apiRecevieOrderWhere = array('api_type'=>'taobaov2', 'other_id'=>$other_id, 'receive_type'=>'send');
        $apiRecevieOrderQuery = $this->api_receive_order->selectApiReceiveOrder($apiRecevieOrderWhere, 'receive_id', 1);
        if ($apiRecevieOrderQuery->num_rows() > 0) {
            $url = $this->config->api_base_url.'taobaoApiV2/taobaoHandBeforeConsume';
        }
        $curlPost = 'order_id='.$order_id.'&mac_id='.$mac_id;
    
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '成功') {
            $this->success('manualoperation/tb_beforeconsume', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/tb_beforeconsume', $this->input->get(), $data);
        }
    }
    
    /**
     * 淘宝手动发码
     */
    public function tb_send()
    {
        $data = array('type'=>'tb_send');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于淘宝未过期未退票订单(着想平台订单已生成但是未通知淘宝发货)
     */
    public function tbsendPost()
    {
        $order_id = $this->input->get_post('order_id');
    
        $orderBaseQuery = $this->order_base->findById($order_id);
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/tb_send', $this->input->get(), '订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
		$other_id = $orderBaseRow->other_id;
    
        //如果不是淘宝订单
        if(($bit_wan&2048) != 2048) {
            $this->error('manualoperation/tb_send', $this->input->get(), '订单'.$order_id.'不是淘宝订单');
        }
    
        //$url = $this->config->main_base_url.'api/tbopen/send';
		$url = $this->config->api_base_url.'taobaoApi/taobaoHandSend';
		//查询订单是码商系统V1下的订单还是码商系统V2下的订单
        $apiRecevieOrderWhere = array('api_type'=>'taobaov2', 'other_id'=>$other_id, 'receive_type'=>'send');
        $apiRecevieOrderQuery = $this->api_receive_order->selectApiReceiveOrder($apiRecevieOrderWhere, 'receive_id', 1);
        if ($apiRecevieOrderQuery->num_rows() > 0) {
            $url = $this->config->api_base_url.'taobaoApiV2/taobaoHandSend';
        }
        $curlPost = 'order_id='.$order_id;
    
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '成功') {
            $this->success('manualoperation/tb_send', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/tb_send', $this->input->get(), $data);
        }
    }
    
    /**
     * 淘宝手动重新发码
     */
    public function tb_resend()
    {
        $data = array('type'=>'tb_resend');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于淘宝未过期未退票订单(着想平台订单已生成且已通知淘宝发货,但是因为一些原因,需要重新通知淘宝发货)
     */
    public function tbresendPost()
    {
        $order_id = $this->input->get_post('order_id');
    
        $orderBaseQuery = $this->order_base->findById($order_id);
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/tb_resend', $this->input->get(), '订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
		$other_id = $orderBaseRow->other_id;
    
        //如果不是淘宝订单
        if(($bit_wan&2048) != 2048) {
            $this->error('manualoperation/tb_resend', $this->input->get(), '订单'.$order_id.'不是淘宝订单');
        }
    
        //$url = $this->config->main_base_url.'api/tbopen/resend';
		$url = $this->config->api_base_url.'taobaoApi/taobaoHandResend';
		//查询订单是码商系统V1下的订单还是码商系统V2下的订单
        $apiRecevieOrderWhere = array('api_type'=>'taobaov2', 'other_id'=>$other_id, 'receive_type'=>'send');
        $apiRecevieOrderQuery = $this->api_receive_order->selectApiReceiveOrder($apiRecevieOrderWhere, 'receive_id', 1);
        if ($apiRecevieOrderQuery->num_rows() > 0) {
            $url = $this->config->api_base_url.'taobaoApiV2/taobaoHandResend';
        }
        $curlPost = 'order_id='.$order_id;
    
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '成功') {
            $this->success('manualoperation/tb_resend', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/tb_resend', $this->input->get(), $data);
        }
    }
    
    /**
     * 淘宝手动冲正
     */
    public function tb_reverse()
    {
        $data = array('type'=>'tb_reverse');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于淘宝未过期订单(着想平台订单已核销淘宝订单也核销了,但是因为一些原因,需要改淘宝订单为未核销的状态)
     */
    public function tbreversePost()
    {
        $order_id = $this->input->get_post('order_id');
		$number = $this->input->get_post('number');
        $mac_id = $this->input->get_post('mac_id');
    
        $orderBaseQuery = $this->order_base->findById($order_id);
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/tb_reverse', $this->input->get(), '订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
		$other_id = $orderBaseRow->other_id;
    
        //如果不是淘宝订单
        if(($bit_wan&2048) != 2048) {
            $this->error('manualoperation/tb_reverse', $this->input->get(), '订单'.$order_id.'不是淘宝订单');
        }
    
        //$url = $this->config->main_base_url.'api/tbopen/reverse';
		$url = $this->config->api_base_url.'taobaoApi/taobaoHandReverse';
		//查询订单是码商系统V1下的订单还是码商系统V2下的订单
        $apiRecevieOrderWhere = array('api_type'=>'taobaov2', 'other_id'=>$other_id, 'receive_type'=>'send');
        $apiRecevieOrderQuery = $this->api_receive_order->selectApiReceiveOrder($apiRecevieOrderWhere, 'receive_id', 1);
        if ($apiRecevieOrderQuery->num_rows() > 0) {
            $url = $this->config->api_base_url.'taobaoApiV2/taobaoHandReverse';
        }
        $curlPost = 'order_id='.$order_id.'&number='.$number.'&mac_id='.$mac_id;
    
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '成功') {
            $this->success('manualoperation/tb_reverse', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/tb_reverse', $this->input->get(), $data);
        }
    }
    
    /**
     * 淘宝手动延期
     */
    public function tb_edittime()
    {
        $data = array('type'=>'tb_edittime');
        $this->load->view('manualoperation/index',$data);
    }
    
    /**
     * 用于可以延期的淘宝订单(如果淘宝订单延期成功,而着想没有延期成功,需手动延期订单)
     */
    public function tbedittimePost()
    {
        $order_id = $this->input->get_post('order_id');
        $plantime = $this->input->get_post('plantime');
    
        $orderBaseQuery = $this->order_base->order_select_where(array('other_id'=>$order_id));
        if($orderBaseQuery->num_rows() <= 0) {
            $this->error('manualoperation/tb_edittime', $this->input->get(), '淘宝订单'.$order_id.'不存在');
        }
        $orderBaseRow = $orderBaseQuery->row();
        $bit_wan = $orderBaseRow->bit_wan;
		$other_id = $orderBaseRow->other_id;
    
        //如果不是淘宝订单
        if(($bit_wan&2048) != 2048) {
            $this->error('manualoperation/tb_edittime', $this->input->get(), '订单'.$order_id.'不是淘宝订单');
        }
        if($plantime < date('Y-m-d')) {
            $this->error('manualoperation/tb_edittime', $this->input->get(), '订单'.$order_id.'延期日期不得小于今天');
        }
    
        //$url = $this->config->main_base_url.'api/tbopen/handEditTaobaoPlantime';
		$url = $this->config->api_base_url.'taobaoApi/handEditTaobaoPlantime';
		//查询订单是码商系统V1下的订单还是码商系统V2下的订单
        $apiRecevieOrderWhere = array('api_type'=>'taobaov2', 'other_id'=>$other_id, 'receive_type'=>'send');
        $apiRecevieOrderQuery = $this->api_receive_order->selectApiReceiveOrder($apiRecevieOrderWhere, 'receive_id', 1);
        if ($apiRecevieOrderQuery->num_rows() > 0) {
            $url = $this->config->api_base_url.'taobaoApiV2/handEditTaobaoPlantime';
        }
        $curlPost = 'order_id='.$order_id.'&plantime='.$plantime;
    
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && $data == '成功') {
            $this->success('manualoperation/tb_edittime', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/tb_edittime', $this->input->get(), $data);
        }
    }
	
	//淘宝订单重新推送
    public function tb_resend_order()
    {
        $data = array('type'=>'tb_resend_order');
        $this->load->view('manualoperation/index',$data);
    }
	 
    //淘宝订单重新推送-显示推送订单信息
    public function order_show()
    {
        $order_id = $this->input->get_post('order_id');
		$errorLogQuery = $this->api_taobao->get_error_log_by_order_id($order_id);
		if($errorLogQuery->num_rows() <= 0) {
            $this->error('manualoperation/tb_resend_order', '', '无该订单错误日志信息！');
        }	
		$data['value'] = $errorLogQuery->row();
		$this->load->view('manualoperation/order',$data);
    }
	 
    //淘宝订单重新推送-提交推送请求
    public function orderPost()
    {
        $params = $this->input->post();
		$other_id = $this->input->post('order_id');
		
        //$url = $this->config->main_base_url.'api/tbopen/index';
        $url = $this->config->api_base_url.'taobaoApi';
		//查询订单是码商系统V1下的订单还是码商系统V2下的订单
        $apiRecevieOrderWhere = array('api_type'=>'taobaov2', 'other_id'=>$other_id, 'receive_type'=>'send');
        $apiRecevieOrderQuery = $this->api_receive_order->selectApiReceiveOrder($apiRecevieOrderWhere, 'receive_id', 1);
        if ($apiRecevieOrderQuery->num_rows() > 0) {
            $url = $this->config->api_base_url.'taobaoApiV2';
        }
        
        $curlPost = "";
        while (list($k,$v) = each($params))
        {
            $curlPost .= $k."=".$v."&";	//转URL标准砿
        }
        $curlPost = substr($curlPost,0,-1);
        
        $data = $this->curl($url,$curlPost);
        $data = preg_replace("/(\r\n|\n|\r|\t)/i", '', $data);
        if($data && ($data == '成功' || $data == '{"code":200}')) {
            $this->success('manualoperation/tb_resend_order', $this->input->get(), $data);
        } else {
            $this->error('manualoperation/tb_resend_order', $this->input->get(), $data);
        }
    }
    
    /*//淘宝订单重新推送
	public function tb_resend_order()
	{
	 	$data = array('type'=>'tb_resend_order');
        $this->load->view('manualoperation/index',$data);
	}
	 
	//淘宝订单重新推送-显示推送订单信息
	public function order_show()
	{
	 	$order_id=$this->input->get_post('order_id');
		$q=$this->api_taobao->get_error_log_by_order_id($order_id);
		if($q->num_rows()<=0)
		{
		 	$this->error('manualoperation/tb_resend_order', '', '无该订单错误日志信息！');
		}	
		$data['value']=$q->row();
		$this->load->view('manualoperation/order',$data);
	}
	 
	//淘宝订单重新推送-提交推送请求
	public function orderPost()
	{
	    $params = $this->input->post();
	    $url = $this->config->main_base_url.'api/tbopen/index';
		$result = getApiDynamic($params,$url);
		if ($result)
		{
			$res_arr = json_decode($result,TRUE);
		}
		if(isset($res_arr['code']) && (200 == $res_arr['code']))
		{
			$this->success('manualoperation/tb_resend_order', '', '提交成功！');
		}
		else
		{
			$desc = '';
			$pos = mb_strpos($result, '}');
			if(FALSE !== $pos)
			{
				$desc = mb_substr($result,$pos+1);
			}
			$this->error('manualoperation/tb_resend_order', '', '提交失败！'.$desc);
		}
	}*/
}